﻿Imports System.Data
Imports System.Data.SqlClient
Public Class ThongTinNguoiThue

    Private Sub ThongTinNguoiThue_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim bang As DataTable = NhaChoThue_BUS.loadDuLieuComBoxNguoiChoThue()
        cmbLoaiNha.DataSource = bang
        cmbLoaiNha.DisplayMember = "TenLoaiNhaChoThue"
        cmbLoaiNha.ValueMember = "MaLoaiNha"
    End Sub

    Private Sub btnThem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThem.Click
        Dim NguoiThueNha As New NguoiThueNha_DTO()
        NguoiThueNha.CMND = txtCMND.Text
        NguoiThueNha.DiaChi = txtDiaChi.Text
        NguoiThueNha.DiaDiem = txtDiaDiem.Text
        NguoiThueNha.DienThoai = txtDienThoai.Text
        NguoiThueNha.GiaMax = txtGiaMax.Text
        NguoiThueNha.GiaMin = txtGiaMin.Text
        NguoiThueNha.TenNguoiThue = txtHoTen.Text
        NguoiThueNha.MaLoaiNha = cmbLoaiNha.SelectedValue
        'NguoiThue.SoNguoiO = TxtSoNguoiO.Text
        If NguoiThueNha.GiaMax > NguoiThueNha.GiaMin Then
            NguoiThueNha_BUS.ThemDuLieuNguoiThue(NguoiThueNha)
            txtCMND.Clear()
            txtDiaChi.Clear()
            txtDiaDiem.Clear()
            txtDienThoai.Clear()
            txtGiaMax.Clear()
            txtGiaMin.Clear()
            txtHoTen.Clear()
        Else
            MessageBox.Show("bạn nhập lại giá")
        End If
    End Sub

    Private Sub btnThoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThoat.Click
        Me.Close()
    End Sub
End Class